package com.example.service.common.api.fallback;


import com.example.service.common.api.Service1;
import com.example.service.common.api.entity.ResponseResult;
import com.example.service.common.api.entity.ServiceStateCode;
import com.example.service.common.dto.FileTestDto;
import com.example.service.common.dto.TestDto;
import com.example.service.common.vo.TestVo;
import org.springframework.stereotype.Component;

import java.time.LocalDate;

@Component
public class Service1FallBack implements Service1 {
    @Override
    public ResponseResult<TestVo> noArgGet() {
        System.out.println("noArgGet    服务降级");
        return ResponseResult.failure(ServiceStateCode.FAILURE);
    }

    @Override
    public ResponseResult<TestVo> pathArgGet(String name, LocalDate date) {
        System.out.println("pathArgGet  服务降级");
        return ResponseResult.failure(ServiceStateCode.FAILURE);
    }

    @Override
    public ResponseResult<TestVo> pathAndBodyArgPost(String name, LocalDate date, TestDto dto) {
        System.out.println("pathAndBodyArgPost  服务降级");
        return ResponseResult.failure(ServiceStateCode.FAILURE);
    }

    @Override
    public TestVo pathAndBodyArgPut(String name, LocalDate date, TestDto dto) {
        System.out.println("pathAndBodyArgPut  服务降级");
        return TestVo.defaultCreate().setName("pathAndBodyArgPut  服务降级");
    }

    @Override
    public ResponseResult<TestVo> pathAndBodyArgAndFileArgPost(String e, FileTestDto fileTestDto) {
        System.out.println("pathAndBodyArgAndFileArgPost  服务降级,其实是不支持文件格式");
        return ResponseResult.failure(ServiceStateCode.FAILURE);
    }
    @Override
    public ResponseResult<TestVo> pathAndBodyArgPostHystrix(String name, TestDto dto) {
        System.out.println("pathAndBodyArgPostHystrix  服务降级");
        return ResponseResult.failure(ServiceStateCode.FAILURE);
    }

    @Override
    public ResponseResult<TestVo> noArgGetHystrix() {
        System.out.println("noArgGetHystrix  服务降级");
        return ResponseResult.failure(ServiceStateCode.FAILURE);
    }

}
